<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.operations.process.forms.GroupFabStageForm,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.commons.SessionKeys" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<%  String closeWindowAfterSessionTimeOut = ( String ) request.getAttribute( "closeWindowAfterSessionExp" );
    if ( closeWindowAfterSessionTimeOut == null )
    {
%>
    <chiptrack:checkLogon sourcePage="/groupFabStage.do"/>
<%  } %>

<%    User user1 = (User)session.getAttribute (SessionKeys.USER_KEY); %>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<script language="javascript">
 function finalSave()
 {
    var form = document.addStageForm;
    var pa =document.getElementById("errors");
    var pa1 =document.getElementById("message");
	pa1.innerHTML = '';
    pa.innerHTML = '';
    form.fabstageName.value = trim(form.fabstageName.value);
    if ( form.fabstageName.value == '' )
    {
        pa1.innerHTML = "<li>Please Enter Stage Name</li>";
        document.addStageForm.fabstageName.focus();
        return;
    }
    document.addStageForm.action.value="saveFabStage";
	document.addStageForm.submit();
 }

 function closeWindow()
 {
    window.opener.selectAll();
    window.opener.document.groupFabStageForm.action.value="reloadStages";
    window.opener.document.groupFabStageForm.submit();
    window.close();
 }

</script>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
<%
if ( closeWindowAfterSessionTimeOut == null )
{
%>

<html:form name="addStageForm" type="com.scalar.chiptrack.operations.process.forms.GroupFabStageForm" action ="/groupFabStage.do" >

    <table border="0" width="100%" align="center">
    <tr>
        <td colspan=5 width="50%" align=right>
            <a href="javascript:closeWindow();" title='Click here to close this window' onMouseOver="window.status='Click here to close this window';return true"><font class='NArialL'><b>[Close this window]</b></font></a>
        </td>
    </tr>

    <tr>
        <td colspan=5>&nbsp;</td>
    </tr>

    <tr>
        <td colspan=5 class="NArialW" align="center">Add Stage Names</td>
    </tr>
    <tr><td colspan=5 class='NArialL'><strong><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></td></tr>
    <tr>
        <td colspan=5>&nbsp;</td>
    </tr>

     <tr><td colspan=5 id = "errors">
        <chiptrack:info styleClass="NArialL" />
        <chiptrack:errors styleClass="NArialL" />
        <chiptrack:messages type="info" styleClass="NArialL" />
    </td></tr>

    <tr>
        <td width="100%">
        <table align="center" width = "100%" border=0 valign=top>
        <tr>
            <td width ="50%" class='NArialL'>Fab Stage Name:</td>
            <TD width="30%" class='NArialL'><html:text property="fabstageName" size="15" maxlength="30" styleClass="txfield" name="groupFabStageForm" onkeypress="return noenter( event )"/></TD>
            <td width="20%" class='NArialL'>&nbsp;</td>
        </tr>
        </table>
        </td>
    </tr>
    <tr>
        <td colspan="5"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
        </td>
    </tr>

    <tr>
        <td colspan="5" align=center>
	    <a href="javascript:finalSave();">
            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" onmouseover="window.status='Click to Save Fab Stage Name';return true" onmouseout="window.status='';return true" title="Click here to Save fab Stage Name"></a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
    </tr>
    <tr>
        <td width="100%">
        <table align="center" width ="100%" border=0 valign=top>
        <tr>
            <td colspan=5 width="50%" align=center>
                <a href="javascript:closeWindow();" title='Click here to close this window' onMouseOver="window.status='Click here to close this window';return true"><font class='NArialL'><b>[Close this window]</b></font></a>
            </td>
        </tr>
        </table>
        </td>
    </tr>
</TABLE>
<input type="hidden" name="action" value="">
</html:form>
<% } else { %>
    <table cellpadding='0' cellspacing='0' bgcolor='FDF5E6' border="0" width="100%"  height="100%" align=center>
        <tr>
            <td>
                <table align="center" border="0" width="40%" bgcolor="#FDF5E6">
                    <tr><td>&nbsp;</td></tr>
                    <tr><td align="center" ><font class="NArialL" ><font color="red">Session has been time out , Please close this window and login again.</font></font></td></tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr><td align="center" ><a href="javascript:window.close();"><font class='NArialL'>[Close this window]</font></a></td></tr>
                </table>
            </td>
       </tr>
       <tr><td>&nbsp;</td></tr>
    </table>
<% } %>
</BODY>
</HTML>
